<?php
class MagicTest {
    #method overloading
    public function __call($name, $arguments) {
        echo "Calling " . $name . "with parameters: " . implode(",", $arguments) . "<br>";
    }

    #method overloading
    public static function __callStatic($name, $arguments) {
        echo "Static calling " . $name . "with parameters: " . implode(",", $arguments) . "<br>";
    }

    public function __get($name) {
        return "Getting the property " . $name;
    }

    public function __set($name, $value) {
        echo "Setting the property " . $name ."to value " . $value . "<br>";
    }

    public function __isset($name) {
        echo "__isset invoke <br>" ;
        return true;
    }

    public function __unset($name) {
        echo "unsetting property " . $name . "<br>";
    }
}

#$obj = new MagicTest();
#$obj->runTest("para", "para1");
#MagicTest::runTest("para", "para1");

$obj = new MagicTest();
echo $obj->className;
echo "<br>";
$obj->className = "MagicClassX";
echo "\$obj->className is set ? " . isset($obj->className) . "<br>";
echo "\$obj->className is set ? " . empty($obj->className) . "<br>";
unset($obj->className);

?>
